import gnu.targets.ITarget;

metaonly module GCArmv4 inherits ITarget {
    override readonly config string name		= "GCArmv4";	
    override readonly config string suffix		= "v4";
    override readonly config string isa			= "v4";
    override readonly config xdc.bld.ITarget.Model model= {
	endian: "little"
    };

//    override config Bool noStdLinkScript = true;

    override readonly config string rts	= "sysbios.targets.gnu.rtsv4";
    override config string platform	= "host.platforms.arm";
    
    override config string LONGNAME;

    override readonly config String stdInclude = "sysbios/targets/gnu/std.h";

    override readonly config ITarget.Command cc = {
        cmd: "$(rootDir)/$(LONGNAME) -c -MD -MF $@.dep",
        opts: "-march=armv4"
    };

    override config ITarget.Options ccOpts = {
	prefix: "-Wunused",
	suffix: "-Dfar= "
    };

    override readonly config ITarget.Command asm = {
	cmd: "$(rootDir)/$(LONGNAME) -c -x assembler",
	opts: "-march=armv4"
    };

    override config ITarget.Options lnkOpts = {
	prefix: "-u start -nostdlib -Wl,-Map=$(XDCCFGDIR)/$@.map,--gc-sections ",
	suffix: "-L$(rootDir)/$(GCCTARG)/lib"
    };
	
    /*
     *  ======== compatibleSuffixes ========
     */
    override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
        t_IArg          : { size: 4, align: 4 },
        t_Char          : { size: 1, align: 1 },
        t_Double        : { size: 8, align: 4 },
        t_Float         : { size: 4, align: 4 },
        t_Fxn           : { size: 4, align: 4 },
        t_Int           : { size: 4, align: 4 },
        t_Int8          : { size: 1, align: 1 },
        t_Int16         : { size: 2, align: 2 },
        t_Int32         : { size: 4, align: 4 },
	t_Int64		: { size: 8, align: 4 },
        t_Long          : { size: 4, align: 4 },
        t_LDouble       : { size: 8, align: 4 },
        t_LLong         : { size: 8, align: 4 },
        t_Ptr           : { size: 4, align: 4 },
        t_Short         : { size: 2, align: 2 },
    };
}
